/**
 * Filename: YNUpList.java
 *
 * @author Firefly
 * @contact postfirefly@163.com
 * @time 2016/3/19 19:48
 */
package com.github.postsanf.yinian.bean;

import com.github.postsanf.yinian.utils.StringUtils;

/**
 * 上传信息
 */
public class YNUpList extends BaseBean {
    private int upid;                                        // ID
    private String upimg;                                        // 上传图
    private String uptime;                                        // 上传时间、
    private String upgname;                                    // 上传组名
    private String upgntitle;                                    // 上传标题
    private int uppercent;                                    // 上传进度
    private long upsize = 0;                                    // 已上传大小
    private String upTotalSize;                                // 上传总大小
    private String upSpeed = "0.00 KB/s";                        // 上传速度
    private boolean isCancel = false;                            // 上传状态  进行 true / 暂停 false

    public YNUpList(int upid, String upimg, String uptime, String upgname, int uppercent, String upTotalSize) {
        this.upid = upid;
        this.upimg = upimg;
        this.uptime = uptime;
        this.upgname = upgname;
        this.uppercent = uppercent;
        this.upTotalSize = upTotalSize;
        setUpgntitle(upgname);
    }

    public YNUpList(int upid, String upimg, String uptime, String upgname, int uppercent, long upsize, String upTotalSize, boolean isCancel) {
        this.upid = upid;
        this.upimg = upimg;
        this.uptime = uptime;
        this.upgname = upgname;
        this.uppercent = uppercent;
        this.upsize = upsize;
        this.upTotalSize = upTotalSize;
        this.isCancel = isCancel;
        setUpgntitle(upgname);
    }


    public String getUpTotalSize() {
        return upTotalSize;
    }

    public void setUpTotalSize(String upTotalSize) {
        this.upTotalSize = upTotalSize;
    }

    public String getUpSpeed() {
        return upSpeed;
    }

    public void setUpSpeed(String upSpeed) {
        this.upSpeed = upSpeed;
    }

    public boolean isCancel() {
        return isCancel;
    }

    public void setIsCancel(boolean isCancel) {
        this.isCancel = isCancel;
    }

    public String getUpgntitle() {
        return upgntitle;
    }

    public void setUpgntitle(String upgntitle) {
        if (!StringUtils.isEmpty(upgntitle) && !upgntitle.equals("null")) {
            this.upgntitle = "上传照片到《" + upgntitle + "》圈子";
        } else {
            this.upgntitle = "上传到圈子中";
        }
    }

    public int getUpid() {
        return upid;
    }

    public void setUpid(int upid) {
        this.upid = upid;
    }

    public String getUpimg() {
        return upimg;
    }

    public void setUpimg(String upimg) {
        this.upimg = upimg;
    }

    public String getUptime() {
        return uptime;
    }

    public void setUptime(String uptime) {
        this.uptime = uptime;
    }

    public String getUpgname() {
        return upgname;
    }

    public void setUpgname(String upgname) {
        this.upgname = upgname;
    }

    public int getUppercent() {
        return uppercent;
    }

    public void setUppercent(int uppercent) {
        this.uppercent = uppercent;
    }

    public long getUpsize() {
        return upsize;
    }

    public void setUpsize(long upsize) {
        this.upsize = upsize;
    }

    @Override
    public boolean equals(Object o) {
        if (o instanceof YNUpList) {
            return this.upid == ((YNUpList) o).upid;
        }
        return super.equals(o);
    }
}